/***
 * Autoload Langage
 */

Ext.define('EUniversityParams', {
	 extend: 'Ext.util.Observable',
	 constructor: function(){

            this.callParent(arguments);
            this.addEvents({
                'initAllTerminated' : true,
                'initAllInfoUserTerminated' : true,
                'initAllInfoTranslationTerministed' : true,
                'AllTreeDataPilotLoaded' : true
            });
          //  this.LoadDataTranslate();
           
       },
	getDataTranslate:{},
	getCurentUser:{},
	getGlobalMenu:{},
	getPermission:{},
	getPrincipalTranslate:{},
    LoadDataTranslate:function(){
    	var tmp=Array();
    	var me=this;
    	Ext.Ajax.request({
		    url: 'admin/administration/gettranslate',
		    success: function(response){
		    	var jsonData = Ext.JSON.decode(response.responseText);
		    	 Ext.iterate(jsonData.results,function(key,value){
		    	 	tmp[key]=value;
		    	 });
		    	 me.fireEvent('initAllTerminated', 'true', tmp);
		    },
	        failure: function(response, opts) {
               alert('erreur');
               me.fireEvent('initAllTerminated','false','Erreur');
            }
		});
		//translateTab=tmp;
		this.getDataTranslate=tmp;
    },
     LoadPrincipalTranslate:function(formtotranslate){
    	var tmp=Array();
    	Ext.Ajax.request({
		    url: 'devadmin/superadmin/get-translate'+formtotranslate,
		    success: function(response){
		    	var jsonData = Ext.JSON.decode(response.responseText);
		    	 Ext.iterate(jsonData.results,function(key,value){
		    	 	tmp[key]=value;
		    	 })
		    	
		    	 
		    },
	        failure: function(response, opts) {
               alert('erreur');
               
          }
          
		});
	
		this.getPrincipalTranslate=tmp;
		
    },
    LoadTreeData:function(idmodel){
    	
    	var store=Array();
    	var tmpresponse=array();
    	var me=this;
    	
    	//chargement des data de store
   	
   	 
   //chargement des donnée de fields de store
   	Ext.Ajax.request({
 		url: 'pilotage/projectbord/jsonstructerdataboard',
 		params: { id:idmodel  },
		    success: function(responseh){
		    	tmpresponse[0]=responseh.responseText;
		    	
		    }
   	});
   	
   	Ext.Ajax.request({
 		url: 'pilotage/projectbord/piedashbord',
 		params: { id:idmodel  },
		    success: function(responsechart){
		    	tmpresponse[1]=responsechart.responseText;
		    }
   	});
    	
	 Ext.Ajax.request({
		url: 'pilotage/projectbord/dycolumnboard',
		 params: { id:idmodel  },
	     success: function(response1){
	    	tmpresponse[2]=response1.responseText;
	     }
      });
	 
	 Ext.Ajax.request({
   		 url: 'pilotage/projectbord/loaddataboard',
   		 params: { id:idmodel  },
		    success: function(response){
		    	globalStore=response.responseText;
		    	tmpresponse[3]=response.responseText;
		    }
   	 });
	 
	 
	 
	 
    	store[0] = Ext.create('Ext.data.JsonStore', {
    		fields:Ext.JSON.decode(tmpresponse[0]),
			data:Ext.JSON.decode(tmpresponse[3])
        });
	    	
	    	
    	store[1]=Ext.create('Ext.data.JsonStore', {
    		fields:Ext.JSON.decode(tmpresponse[0]),
			data:Ext.JSON.decode(tmpresponse[3])
    	});
	    	
       store[2] = Ext.JSON.decode(tmpresponse[2]);
       me.fireEvent('AllTreeDataPilotLoaded', 'true', store);
    	
    }
    
    
});



